<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
    <title>幸运乐翻天</title>
    <link href="./static/css/app.css?time=<%=System.currentTimeMillis()%>" rel="stylesheet">
</head>

<body>
<div id="app" class="bg">
    <jsp:include page="top.jsp"/>
    <div class="continer">
        <div class="gift">
            <Top :money="amount"></Top>
            <div class="succCard">
                <div class="waper">
                    <div class="icon">
                    </div>
                    <div class="text">
                        <div class="title">
                            您已成功领取卡密！
                        </div>
                        <div class="desc">
                            请勿将卡密泄露给任何人，并尽快使用。<br/>长按即可复制卡号、密码。
                        </div>
                    </div>
                </div>
                <div class="btn">
                    <a href="/explain.html">查看使用说明</a>
                </div>
            </div>
            <div class="cards">
                <div class="title">
                    以下是全部卡密信息
                </div>
                <div id="key">

                </div>
            </div>
            <div class="loading-container" v-show="!cards.length">
                <Loading></Loading>
            </div>
        </div>
    </div>
</div>
<script src="/static/js/jquery-3.2.1.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="/static/js/home.js?time=<%=System.currentTimeMillis()%>" charset="utf-8"></script>
<script>
    $(function() {
        if(localStorage.user){
            var user = JSON.parse(localStorage.user);
            console.log({userId: user.userId,token:user.token,goodsExtendIds:${goodsExtendIds}})
            $.ajax({
                method: "POST",
                url: "/topfun/look/key",
                data: {userId: user.userId,token:user.token,goodsExtendIds:${goodsExtendIds}},
                success: function (result) {
                    if(result){
                        var json = JSON.parse(result);
                        var keys = JSON.parse(json.data) || [];
                        var html = '';
                        keys.forEach(function (value) {
                            html += '<div class="item" >'+
                                '  <div class="iNo">'+
                                '      <label class="lb">卡号：</label>'+
                                '      <span class="input">'+value.CardNumber+'</span>'+
                                '  </div>'+
                                '  <div class="iPass">'+
                                '      <label class="lb">密码：</label>'+
                                '      <span class="input">'+value.key+'</span>'+
                                '  </div>'+
                                '</div>';
                        })
                        $('#key').html(html);
                    }
                }
            }).fail(function () {
                alert("$.ajax /topfun/look/key failed!");
            })
        }
    });
</script>
</body>

</html>
